class Solution {
public:
    bool isOneBitCharacter(vector<int>& bits) {
        int n=bits.size();
        int i=0;
        while(i<n-1) i+=bits[i]+1; //知道剩下至多1位字符
        return i==n-1;
    }
};